<?php

namespace App\Http\Requests;

class ArticleCategoryRequest extends Request
{
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        $id = $this->route('category');
        return [
            'name'=>'required|unique:article_categories,name,' . $id,
            'sort'=> 'min:0|max:999999999'
        ];
    }

    public function messages()
    {
        return [
            'name.required' => '请输入名称',
            'name.unique' => '此名称已存在',
            'sort.min' => '排序最小值为0',
            'name.max' => '排序最小值为999999999',
        ];
    }
}
